home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 2553 < prev    next >
Encoding:
Text File  |  1996-08-06  |  1.8 KB  |  49 lines

  1. Newsgroups: comp.os.ms-windows.programmer.ole,comp.lang.c++
  2. Path: green.baan.nl!jeroenn
  3. From: jeroenn@green.baan.nl (Jeroen Nikkels)
  4. Subject: Re: Problems VC++4.0 & StringFromCLSID function
  5. Sender: news@baan.nl
  6. Message-ID: <DLD9K4.HnM@baan.nl>
  7. Date: Thu, 18 Jan 1996 07:45:40 GMT
  8. X-Nntp-Posting-Host: green.baan.nl
  9. References:  <4djn2d$mps@earth.superlink.net>
  10. Organization: Baan International b.v.
  11.  
  12. In article <4djn2d$mps@earth.superlink.net>, ananda@mars.superlink.net (Ananda Subramaniam) writes:
  13. |> Hi,
  14. |> 
  15. |> I have an OLE sample that I wrote and compiled in VC++ 2.0 without any problems.
  16. |> However, when I tried to compile in VC++ 4.0, I had trouble with the
  17. |> StringFromCLSID function. 
  18. |> 
  19. |> I get a message "cannot convert 2nd parameter char ** to unsigned short**"
  20. |> 
  21. |> The Prototype for StringFromCLSID is:
  22. |> StringFromCLSID(REFCLSID, LPOLESTR *);
  23. |> 
  24. |> I am passing as my second parameter a LPSTR *, which shouldn't be a problem
  25. |> because grepping through the several include files provided by MS there is a
  26. |> typedef as follows
  27. |> 
  28. |> typedef LPSTR LPOLESTR;
  29.  
  30. In the file wtypes.h there are also typedefs for
  31.    typedef WCHAR OLECHAR
  32.    typedef const OLECHAR *LPOLESTR;
  33.  
  34. All OLE functions use unicoded string arguments. Probably your VC++ 2.0
  35. settings included the define OLE2ANSI to use ansi strings.
  36.  
  37. You should use the function MultiByteToWideChar(...) to convert an ansi
  38. string to a unicode string.
  39.  
  40. This should help you out !
  41.  
  42. greetings,
  43. -- 
  44. # Jeroen Nikkels                          Baan Development B.V.     #
  45. # Technology Development                  Baron van Nagellstraat 89 #
  46. # Phone: +31 (0)342 428808                P.O. Box 143              #
  47. # Fax  : +31 (0)342 428787                3770 AC Barneveld         #
  48. # Email: jeroenn@baan.nl                  The Netherlands           #
  49.